import asyncio
import time

from parsel import Selector

from re_common.baselibrary.utils.basemotor import BaseMotor

bs = BaseMotor()
bs.AsyncIOMotorClient(
    "mongodb://192.168.31.168:27017",
    "collection")
bs.get_col("cnki_article_detail_redown")

bs2 = BaseMotor()
bs2.AsyncIOMotorClient(
    "mongodb://192.168.31.30:32417",
    "htmljson")
bs2.get_col("cnki_article_detail_redown")


async def dic_hook(doc):
    print(doc["_id"])
    doc["refdicts"]["redown"] = 1
    await bs2.insert_one(doc)


async def run():
    await bs.find(dic_hook, {})


asyncio.get_event_loop().run_until_complete(run())
